using UnityEngine;

public class GGFacebookAndroid : GGFacebook
{
	private RuntimePlatform platform = RuntimePlatform.Android;

	private AndroidJavaObject javaShareInstance;

	private AndroidJavaObject javaConnectInstance;

	private AndroidJavaObject javaRequestInstance;

	protected override void Init()
	{
		if (Application.platform != platform)
		{
			return;
		}
		using (AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.giraffegames.unityutil.GGFacebook"))
		{
			javaShareInstance = androidJavaClass.CallStatic<AndroidJavaObject>("instance", new object[0]);
		}
		using (AndroidJavaClass androidJavaClass2 = new AndroidJavaClass("com.giraffegames.unityutil.GGFacebookAuthentication"))
		{
			javaConnectInstance = androidJavaClass2.CallStatic<AndroidJavaObject>("instance", new object[0]);
		}
		using (AndroidJavaClass androidJavaClass3 = new AndroidJavaClass("com.giraffegames.unityutil.GGFacebookFriendsRequest"))
		{
			javaRequestInstance = androidJavaClass3.CallStatic<AndroidJavaObject>("instance", new object[0]);
		}
	}

	public override void showShareDialog(string applicationName, string title, string subtitle, string description, string link)
	{
		if (Application.platform == platform)
		{
			javaShareInstance.Call("showShareDialog", applicationName, title, subtitle, description, link);
		}
	}

	public override void OnTryConnect()
	{
		if (Application.platform == platform)
		{
			javaConnectInstance.Call("onClickLogin", ConfigBase.instance.facebookLoginPermissions);
		}
	}

	public override void OnTryDisconnect()
	{
		if (Application.platform == platform)
		{
			javaConnectInstance.Call("onClickLogout");
		}
	}

	public override bool IsAvailable()
	{
		if (Application.platform != platform)
		{
			return false;
		}
		return true;
	}

	public override bool IsConnected()
	{
		if (Application.platform != platform)
		{
			return false;
		}
		return javaConnectInstance.Call<bool>("IsConnected", new object[0]);
	}

	public override string GetAccessToken()
	{
		if (Application.platform != platform)
		{
			return base.GetAccessToken();
		}
		return javaConnectInstance.Call<string>("GetAccessToken", new object[0]);
	}

	public override void OnClickRequestButton(FriendRequestData requestData)
	{
		if (Application.platform == platform)
		{
			javaRequestInstance.Call("onClickRequestButton", requestData.message, requestData.userIds, requestData.actionType, requestData.objectId);
		}
	}
}
